import request from '@/utils/request'

export function saveResource(params) {
  return request({
    url: '/admin/resource/create',
    method: 'post',
    data: params
  })
}

export function updateResource(params) {
  return request({
    url: '/admin/resource/update',
    method: 'post',
    data: params
  })
}

export function enableResource(id) {
  return request({
    url: '/admin/resource/valid/' + id,
    method: 'post'
  })
}

export function disableResource(id) {
  return request({
    url: '/admin/resource/invalid/' + id,
    method: 'post'
  })
}

export function findByPage(params) {
  return request({
    url: '/admin/resource/findByPage',
    method: 'post',
    data: params
  })
}

export function getResourceTree(platformId) {
  return request({
    url: '/admin/resource/getResourceTreeByPlatform',
    method: 'post',
    params: { 'platformId': platformId }
  })
}
